USE [ShowMeSmart]
GO

drop view [dbo].[view_students_goals]
go

/****** Object:  View [dbo].[view_students_goals]    Script Date: 05/28/2012 21:03:31 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create view [dbo].[view_students_goals]
as
   select  
      goal,
      [target],
      dbo.udf_percent( progress, target) [percent],
      a.* 
      from students_goals a  left outer join goals b on a.goal_id = b.id
      
 
     /*
    
 has history data
  
 select * from student_goals
     
     select * from [view_students_goals]
     
     select student_id from students_goals
     
     alter table students_goals
     add student_id int not null default 0
     
 
	select * from students_goals
	
	select * from goals
	
	select * from students_2_employees
	
     select * from view_students_goals 
     
     select relationship, first_name, id from employees
     
     update employees
        set relationship = 2
        where id = 2
        
*/
GO

